package org.pan;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import org.pan.decorate.StageDecorate;

public class Main extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("index.fxml"));
        fxmlLoader.load();
        primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("excel_128.png")));
        primaryStage.setTitle("一卡通数据导出工具");
        StageDecorate.decorate(primaryStage, fxmlLoader.getRoot());
        primaryStage.show();

        MainController controller = fxmlLoader.getController();
        new StageDrager(primaryStage).bindDrag(controller.banner);

        primaryStage.setOnCloseRequest(event -> {
            Platform.exit();
            System.exit(0);
        });
    }

}
